import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jinke/page/pro_list/model/pro_list_model.dart';
import 'package:jinke/utils/component/component.dart';

import 'package:jinke/utils/util.dart';

import '../../../model/pro_inventory_model.dart';
import '../index.dart';

/// hello
class ProInventoryCell extends StatelessWidget {
  const ProInventoryCell({
    Key? key,
    this.mod,
  }) : super(key: key);
  final ProInventoryModel? mod;
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {},
      child: Container(
        margin: EdgeInsets.fromLTRB(0, 0, 0, 16.r),
        padding: EdgeInsets.symmetric(horizontal: 16.r, vertical: 20.r),
        decoration: BoxDecoration(
            color: Colors.white, borderRadius: BorderRadius.circular(5.r)),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    mod?.name ?? '',
                    style: TextStyle(
                      color: ColorsUtil.title,
                      fontSize: 15.sp,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  SizedBox(
                    height: 14.r,
                  ),
                  Row(
                    children: [
                      TagItem(
                        text: mod?.dataStatus == 'LISTING_STATUS_1'
                            ? '进行中'
                            : '已完成',
                        isActive: true,
                        style: TextStyle(
                            color: ColorsUtil.content, fontSize: 12.sp),
                        activeIcon: Icon(
                          Icons.access_time_filled_sharp,
                          color: ColorsUtil.blue,
                          size: 18.r,
                        ),
                      ),
                      SizedBox(
                        width: 6.r,
                      ),
                      TagItem(
                        text: mod?.responsiblePerson ?? '',
                        isActive: true,
                        style: TextStyle(
                            color: ColorsUtil.content, fontSize: 12.sp),
                        activeIcon: Icon(
                          Icons.person,
                          color: ColorsUtil.content,
                          size: 18.r,
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
            InkWell(
              onTap: () {
                // controller.focus(mod);
              },
              child: Container(
                width: 64.r,
                height: 26.r,
                alignment: Alignment.center,
                decoration: getDecoration(true),
                child: Text(
                  1 == 1 ? '已关注' : '关注',
                  style: TextStyle(
                    color: 1 == 1 ? ColorsUtil.subTitle : Colors.white,
                  ),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }

  Decoration getDecoration(bool isFocus) {
    if (isFocus) {
      return BoxDecoration(
        color: const Color(0xffF2F3F7),
        borderRadius: BorderRadius.circular(2.r),
      );
    }
    return BoxDecoration(
        borderRadius: BorderRadius.circular(2.r),
        gradient: const LinearGradient(
          colors: [
            Color(0xff00A9FE),
            Color(0xff0173FE),
          ],
          begin: Alignment.centerLeft,
          end: Alignment.centerRight,
        ));
  }
}
